package com.wf.protobuf.netty;

import com.wf.protobuf.domain.ProtoMsg;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import lombok.extern.slf4j.Slf4j;

/**
 * 功能描述
 *
 * @author wf
 * @since 2022/5/28
 */
@Slf4j
@ChannelHandler.Sharable
public class ProtobufBusinessHandler extends ChannelInboundHandlerAdapter {
    public static ProtobufBusinessHandler INSTANCE = new ProtobufBusinessHandler();

    @Override
    public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
        ProtoMsg protoMsg = (ProtoMsg) msg;
        log.info("收到proto消息: id is: {}, content is: {}", protoMsg.getId(), protoMsg.getContent());
    }
}
